var t = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../dist/dialog/dialog")), a = getApp();

Page({
    data: {
        current_index: 0,
        list: [],
        page: 1,
        total_page: 1,
        status_list: [ {
            text: "全部",
            apply_status: 0
        }, {
            text: "待审核",
            apply_status: 1
        }, {
            text: "审核通过",
            apply_status: 2
        } ]
    },
    onLoad: function(t) {
        this.getData();
    },
    choose: function(t) {
        var a = t.currentTarget.dataset.status;
        this.setData({
            current_index: a
        }), this.getData({
            apply_status: a,
            page: 1
        });
    },
    apply_handle: function(e) {
        var s = this, n = e.currentTarget.dataset.id, r = e.currentTarget.dataset.type, i = "";
        i = "pass" == r ? "是否确认通过该门店申请？" : "是否确认驳回该门店申请？", t.default.confirm({
            message: i
        }).then(function() {
            var t = "";
            t = "pass" == r ? "plugin.store-cashier.frontend.store.parent-apply.accept" : "plugin.store-cashier.frontend.store.parent-apply.reject", 
            a._getNetWork({
                url: a.getNetAddresss(t),
                data: {
                    id: n
                },
                success: function(t) {
                    var e = t.data, n = e.result, r = e.msg;
                    a.tips(r), 1 == n && s.getData({
                        apply_status: s.data.current_index
                    });
                }
            });
        }).catch(function() {});
    },
    store_applyfor_details: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageI/store_audit/details/details?id=" + a
        });
    },
    getMoreData: function() {
        if (!(this.data.page >= this.data.total_page)) {
            var t = this.data.page + 1, a = {
                apply_status: this.data.current_index,
                page: t
            };
            this.getData(a);
        }
    },
    getData: function(t) {
        var e = this;
        a._postNetWork({
            url: a.getNetAddresss("plugin.store-cashier.frontend.store.parent-apply.index"),
            data: t,
            success: function(t) {
                var s = t.data, n = s.result, r = s.msg, i = s.data, o = i.current_page, u = i.last_page, p = i.data;
                if (0 == n) return a.tips(r);
                e.setData({
                    page: o,
                    total_page: u
                }), 1 == o ? e.setData({
                    list: p || []
                }) : e.setData({
                    list: e.data.list.concat(p)
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.getMoreData();
    },
    onShareAppMessage: function() {}
});